exports.Createlocation=function(_args)
{
	var pathimage=Ti.App.Properties.getString('pathimage');
	var view = Ti.UI.createView({
		width:_args.width,
		height:'100%',
		backgroundColor:'#c0c0c0',
		//backgroundImage:_arg.backgroundImage,
		top:_args.top,
		right:0,
	})
	
	var btClose = Titanium.UI.createButton({
		 borderColor: '#c0c0c0',
		 borderRadius: 5,
		 borderWidth:2,
		 color:'Black',
		 title:'Đóng',
		 top:0,
		 backgroundImage:pathimage+'bt_red.png',
		 backgroundSelectedImage:pathimage+'bt_red_press.png',
		 width:_args.width,
		 height:	_args.height/10,//Ti.App.Properties.getInt('button_height'),
		 font:{
				//fontSize:Ti.App.Properties.getInt('MainWindow_btnumber_fontsize'),
				fontWeight:'bold',
		 },
   	 	 
	}); 
	btClose.addEventListener('click', function (e) {
		
		Ti.App.fireEvent('back_'+_args.idWinParent)
		
    })
	view.add(btClose)
	/*
	var top_bt=btClose.height+btClose.top;
	var space=10;
	var createButton = function (bt) {
		Ti.API.info ('Chieu dai ff'+bt.Name)
		var bt = Titanium.UI.createButton({
			 borderColor: '#c0c0c0',
		     borderRadius: 6,
		     borderWidth:2,
		     
			 color:'Black',
			 id:bt.id,
			 title:bt.Name,
			 backgroundImage:pathimage+'tb2.png',
			 backgroundSelectedImage:pathimage+'bt_Nau_press.png',
			
			 width:_arg.width-10,
		 	 height:	Ti.App.Properties.getInt('button_height'),
		   	 top:top_bt+space,
		   	 font:{
				//fontSize:Ti.App.Properties.getInt('MainWindow_btnumber_fontsize'),
				fontWeight:'bold',
		 	 },
	   	 	 
		}); 
		bt.addEventListener('click', function (e) {
			Ti.App.fireEvent('TableWindow:locationSelect',{data:e.source.id});
        })
		return bt;
	}
	
	////////////Add Location///////////
	var data=_arg.data
	for (i = 0; i < data.length; i++){
		//Ti.API.info ('Chieu dai'+data[i].Name)
		var btadd=createButton(data[i])
		view.add(btadd);
		top_bt+=btClose.height+space
    }
	*/
	
	var tableview = Ti.UI.createTableView({
		width:_args.width,
		height:'100%',
		backgroundColor: 'Transparent',
		top:btClose.height,
		left:0,
		separatorColor:'Transparent',
	})
	view.add(tableview)
	var LoadTablesDemo_Data = function() {
 		var json=require('db').selectTableScreens();
		return json;
    }
  	var CreateTableViewRow = function(e) {
		var item=e.data;
		var row = Ti.UI.createTableViewRow({
	            height:	_args.height/10,//Ti.App.Properties.getInt('button_height'),
				Id:item.Id,
				Name:item.Name
		})
		var bt=Titanium.UI.createButton({
			 borderColor: Ti.App.Properties.getString('borderColor'),
		     borderRadius: Ti.App.Properties.getInt('borderRadius'),
		     borderWidth:Ti.App.Properties.getInt('borderWidth'),
			 color:'Black',
			 id:item.id,
			 Name:item.Name,
			 title:item.Name,
			 left:0,
			 width:tableview.width,
			 height:	row.height,
		     backgroundImage:pathimage+'tb2.png',
			 backgroundSelectedImage:pathimage+'bt_Nau_press.png',
			 font:{
				//fontSize:Ti.App.Properties.getInt('MainWindow_btnumber_fontsize'),
				fontWeight:'bold',
		 	 },
	   	 	 
	   	 	 
		}); 
		bt.addEventListener('click', function (e) {
			Ti.App.fireEvent('TableWindow:locationSelect',{data:e.source.id});
			
        })
		row.add(bt);
		return row;
	};
    var LoadTables = function() {
    	
 		var tableData=[];
 		var json=[];
 		
 		if (Ti.App.Properties.getInt('IsDemo')==1) 
 		{
 			json=LoadTablesDemo_Data();
 		}
 		else
 		{
 			//json=LoadListDataLocal(e);
 		}
 		
 		//Ti.API.info ('Chieu dai????'+json.length)
 		/*
 		if (json.length==0) {
 			require('settings').Alert_error(win,Globals.connect_pop);
 		}else
 		*/
 		require('settings').LoadingData2TableViewNoScrool(tableview,json,CreateTableViewRow);
	};
	
	LoadTables()
	
	
	
	return view;
}
